import {service as request} from '@/utils/request'

// 获取告警组
// 
export function getList(data) {
  return request({
    url: `/hawk/alarm-group/search/${data.page.current}/${data.page.size}`,
    method: 'get',
    params:data.query
  })
}
//通过groupid获取对应分组下的用户表
export function getListUser(groupid, data) {
    return request({
        url: `/monitor/config/group/${groupid}/${JSON.stringify(data)}`,
        method: 'get'
    })
}
//移除用户
export function remUser(groupid, userid) {
    return request({
        url: `/monitor/config/group/${groupid}/${userid}`,
        method: 'delete'
    })
}
//新增用户
export function insertUser(groupid, ids) {
    return request({
        url: `/monitor/config/group/${groupid}`,
        method: 'post',
        data: ids
    })
}
// 添加分组
// 3.6 
export function doAdd(data) {
    return request({
        url: '/hawk/alarm-group/save',
        method: 'post',
        data
    })
}
// 更新分组
// 3.9
export function doEdit(data) {
    return request({
        url: '/hawk/alarm-group/update',
        method: 'put',
        data
    })
}
// 删除分组
// 3.1
export function doDelete(ids) {
    return request({
        url: `/hawk/alarm-group/del`,
        method: 'delete',
        data:ids
    })
}
export function getAll() {
    return request({
        url: 'moniter/config/group',
        method: 'get'
    })
}

export function getGroupList() {
    return request({
        url: 'moniter/config/group',
        method: 'get'
    })
}

/**
 * 
 * @param {*} id 
 * @returns 
 */
export function getDetail(id) {
    return request({
        url: `/hawk/alarm-group/get/${id}`,
        method: 'get'
    })
}


/**
 * 获取当前登录用户公司下的所有用户
 * @returns 
 * 23.3
 */
 export function getAllUser() {
    return request({
        url: `/hawk/system/user/get/alarm/group`,
        method: 'get'
    })
}


/**
 * 
 * @param {*} id 
 * @returns 
 */
 export function getGroupUser(id) {
    return request({
        url: `/hawk/alarm-group/get/user/${id}`,
        method: 'get'
    })
}
